// Unary Operator Overloading with friend func
#include <iostream>
using namespace std;

class Complex
{
    private:
        int x, y;
    public:
        void setData(int a, int b)
        {
            x=a; y=b;
        }
        void getData()
        {
            cout << x << " " << y <<endl;
        }
        friend Complex operator -(Complex);
};

Complex operator -(Complex X)
{
    Complex temp;
    temp.x = -X.x;
    temp.y = -X.y;
    return temp;
}

int main()
{
    Complex o1, o2;
    o1.setData(5, 8);
    o2 = -o1; // o2 = operator-(o1);
    o1.getData();
    o2.getData();
}